package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import jp.dodododo.aop.config.AspectConfigVisualization;
import jp.dodododo.aop.config.AspectDef;
import jp.dodododo.aop.Pointcut;
import java.util.List;
import java.lang.reflect.AccessibleObject;

public final class samurai_002daop_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.List _jspx_dependants;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n\r\n\r\n\r\n\r\n\r\n\r\n<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\r\n<title>samurai-aop</title>\r\n</head>\r\n<body>\r\n<form action=\"samurai-aop.jsp\" method=\"POST\">\r\n");

request.setCharacterEncoding("UTF-8");
String className = request.getParameter("className");
if(className == null || className.length() == 0) {
	className = "";
}
String methodName = request.getParameter("methodName");
if(methodName == null || methodName.length() == 0) {
	methodName = "";
}
System.out.println(className);

      out.write("\r\n\r\nClassName<input name=\"className\" value=\"");
out.print(className);
      out.write("\" />\r\n<br>\r\nMethodName<input name=\"methodName\" value=\"");
out.print(methodName);
      out.write("\" />\r\n<br>\r\n<input type=\"submit\" />\r\n<hr />\r\n\r\n");

if(0 < className.length()) {
	ClassLoader cl = getClass().getClassLoader();
	while(cl != null) {
		out.println("<h4>");
		out.println(cl);
		out.println("</h4>");

		out.println("<table border=\"1\">");
		List<AspectDef> aspectDefList = AspectConfigVisualization.getAspectDefList(cl, className, methodName);
		for (AspectDef aspectDef : aspectDefList) {
			AccessibleObject staticPart = aspectDef.getStaticPart();
			out.println("<tr>");
			out.println("<td>");
			out.println(staticPart);
			out.println("</td>");
			out.println("<td>");
			out.println("<br />");
			out.println("</td>");
			out.println("</tr>");
			List<Pointcut> pointcutList = aspectDef.getPointcutList();
			for (Pointcut pointcut : pointcutList) {
				out.println("<tr>");
				out.println("<td>");
				out.println("<br />");
				out.println("</td>");
				out.println("<td>");
				out.print(pointcut.getInterceptorStatement());
				out.println("</td>");
				out.println("</tr>");
			}
		}

		out.println("</table>");
		out.println("<hr />");
		cl = cl.getParent();
	}
}

      out.write("\r\n\r\n</form>\r\n</body>\r\n</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
